package com.imooc.controller;

import com.imooc.properties.StudentProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class HelloController {

    @Autowired
    private StudentProperties studentProperties;

    @RequestMapping(value = {"/{id}/say"}, method = RequestMethod.GET)
    public String say(@PathVariable("id") Integer id) {
        return "id:"+id;
    }
    @RequestMapping(value = {"/say"}, method = RequestMethod.GET)
    public String sayGet(@RequestParam("id") Integer myId) {
        return "id:"+myId;
    }
//    @RequestMapping(value = {"/say"}, method = RequestMethod.POST)
    @PostMapping(value = "/say")//简化
    public String sayPost(@RequestParam(value="id",required=false,defaultValue = "0") Integer myId) {
        return "id:"+myId;
    }
}
